package com.hb.trade.client.center;

import com.hb.core.pojo.center.au.dto.*;
import com.hb.core.pojo.center.au.entity.User;
import com.hb.core.pojo.center.au.entity.UserVerify;
import com.hb.core.pojo.center.au.vo.AgencyBidUserVo;
import com.hb.core.pojo.parent.PageResult;
import org.fzzn.core.model.msg.Message;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient("hb-center")
public interface UserClient {
    /**
     * 获取指定用户名的用户
     *
     * @param username 用户名支持手机号
     * @return
     */
    @PostMapping("/user/getByUsername")
    Message<UserDTO> getByUsername(@RequestParam("username") String username);

    /**
     * 判断指定用户是否在黑名单
     * 仅支持用户ID查询
     *
     * @param user
     * @return
     */
    @PostMapping("/user/existsInBlackList")
    Message<Boolean> existsInBlackList(User user);

    /**
     * 获取用户列表信息，带分页
     *
     * @return
     */
    @PostMapping("/user/pageUsers")
    Message<PageResult<UserDTO>> pageUsers(UserDTO userDTO);

    /**
     * 更新用户信息
     * 该方法将忽略对用户名, 密码, 盐的更新
     *
     * @return
     */
    @PostMapping("/user/updateUser")
    Message<Boolean> updateUser(@RequestBody UserDTO userDTO);

    /**
     * 拉黑指定用户或者企业
     *
     * @return
     */
    @PostMapping("/user/pushToBlackList")
    Message<Boolean> pushToBlackList(UserBlacklistDTO userBlack);

    /**
     * 取消拉黑指定用户或者企业
     *
     * @return
     */
    @PostMapping("/user/pullOutOfBlackList")
    Message<Boolean> pullOutOfBlackList(UserBlacklistDTO userBlack);

    /**
     * 保存中招APP的扫码用户信息
     *
     * @param zappUser
     * @return
     */
    @PostMapping("/user/saveZappUser")
    Message<Boolean> saveZappUser(ZappUserDTO zappUser);

    @PostMapping("/user/registerZappUser")
    Message<UserDTO> registerZappUser(ZappUserDTO zappUserDTO);

    /**
     * 删除一个企业用户
     *
     * @param user
     * @return
     */
    @PostMapping("/user/removeUser")
    Message<Boolean> removeUser(UserDTO user);

    /**
     * 更新用户角色
     *
     * @param userDTO
     * @return
     */
    @PostMapping("/user/updateUserRoles")
    Message<Boolean> updateUserRoles(UserDTO userDTO);


    /**
     * 根据用户id查询指定的用户
     *
     * @param userId 用户名id
     * @return
     */
    @PostMapping("/user/getByUserId")
    Message<User> getByUserId(@RequestParam("userId") Long userId);

    /**
     * 重置用户密码
     *
     * @return
     */
    @PostMapping("/user/resetUserPass")
    Message<Boolean> resetUserPass(UserDTO userDTO);

    /**
     * 新增一个系统用户
     *
     * @return
     */
    @PostMapping("/user/addSystemUser")
    Message<Boolean> addSystemUser(UserDTO userDTO);

    /**
     * 获取所有用户信息
     *
     * @param user
     * @return
     */
    @PostMapping("/user/listUsers")
    Message<List<User>> listUsers(UserDTO user);

    /**
     * 获取指定ID的用户信息
     * 该接口用于查询开标大厅即时通讯的好友列表
     *
     * @param userDTO
     * @return
     */
    @PostMapping("/user/listUserByIds")
    Message<List<User>> listUserByIds(@RequestBody List<Long> ids);

    /**
     * 获取指定用户的中招扫码用户信息
     *
     * @param userId
     * @return
     */
    @PostMapping("/user/getZappInfo")
    Message<ZappUserDTO> getZappInfo(@RequestParam("userId") Long userId);

    /**
     * Description: 核对中招扫码信息是否与当前登录人一致
     *
     * @param zaphoneNum 中招扫码信息·手机号
     * @param offerId    投标人id
     * @author: fengbin
     * @date: 2022/2/23 13:51
     * @return: java.lang.Boolean
     */
    @PostMapping("/userConfirmInfo/zappUserConfirmInfo")
    Message<Boolean> zappUserConfirmInfo(@RequestParam("zaphoneNum") String zaphoneNum, @RequestParam("offerId") Long offerId);
    /**
     *
     * @Description:分页查询用户审核列表
     * @Author: zhongdl
     * @Date:2022/3/23 13:33
     * @param agencyUserDTO:
     * @return: {@link Message< PageResult<  AgencyBidUserVo >> }
     **/
    @PostMapping("/user/pageAuditUser")
    Message<PageResult<AgencyBidUserVo>> pageAuditUser(@RequestBody AgencyUserBidDTO agencyUserDTO);

    /**
     *
     * @Description:查看代理机构和投标人的审核详情
     * @Author: zhongdl
     * @Date:2022/3/23 14:30
     * @param agencyUserDTO:
     * @return: {@link Message< AgencyBidUserVo> }
     **/
    @PostMapping("/agencyUser/getAgencyBidUser")
    Message<AgencyBidUserVo> getAgencyBidUser(@RequestBody AgencyUserBidDTO agencyUserDTO);
    /**
     *
     * @Description:审核通过
     * @Author: zhongdl
     * @Date:2022/3/23 14:59
     * @param agencyUserDTO:
     * @return: {@link Message< Boolean> }
     **/
    @PostMapping("/agencyUser/examine")
    Message<Boolean> examine(@RequestBody AgencyUserBidDTO agencyUserDTO);

    /**
     * 根据交易码获取用户id
     *
     * @param verifyCode
     * @return
     */
    @PostMapping("/userVerify/getUserIdByVerifyCode")
    Long getUserIdByVerifyCode(@RequestBody String verifyCode);

    /**
     * 获取中招token是否失效（有效期10天）
     *
     * @author tian
     * @date 2022-6-16 16:58
     * @param userId
     * @return org.fzzn.core.model.msg.Message<java.lang.Boolean>
     */
    @PostMapping("/userVerify/judgeZZToken")
    Message<Boolean> judgeZZToken(@RequestBody Long userId);

    /**
     * 根据身份证和角色查询用户
     * @param zappUserDTO
     * @return
     */
    @PostMapping("/agencyUser/getUserByIdCardAndRoleSign")
    User getUserByIdNumAndRoleSign(@RequestBody ZappUserDTO zappUserDTO);

    /**
     * 根据手机号和角色查询用户
     * @param forgetPasswordDTO
     * @return
     */
    @PostMapping("/agencyUser/getUserByPhoneAndRoleSign")
    User getUserByPhoneAndRoleSign(@RequestBody ForgetPasswordDTO forgetPasswordDTO);

    /**
     * 获取根据用户名和交易码获取绑定信息
     *
     * @param user
     * @return
     */
    @PostMapping("/userVerify/getUserVerifyByUserId")
    Message<UserVerify> getUserVerifyByUserId(@RequestBody User user);

    /**
     * 保存用户CA信息
     *
     * @param userVerify
     * @return
     */
    @PostMapping("/userVerify/saveVerifyByZapp")
    Message<Boolean> saveVerifyByZapp(@RequestBody UserVerify userVerify);

    /**
     * 重新审核用户，更新企业信息和用户信息
     * @param reConfirmUserDTO
     * @return
     */
    @PostMapping("/agencyUser/reConfirmUser")
    Message reConfirmUser(@RequestBody ReConfirmUserDTO reConfirmUserDTO);

    /**
     * 根据用户id查询绑定的第三方ca或者中招
     * @param userVerify
     * @return
     */
    @PostMapping("/userVerify/listVerifyByUserId")
    Message<List<UserVerify>> listVerifyByUserId(@RequestBody UserVerify userVerify);

    /**
     * 获取认证信息
     * @param userVerifyDTO
     * @return
     */
    @PostMapping("/userVerify/findVerifyInfo")
    Message<List<UserVerifyDTO>> findVerifyInfo(@RequestBody UserVerifyDTO userVerifyDTO);

    @PostMapping("/user/getUserByPhoneAndOrgName")
    Message<User> getUserByPhoneAndOrgName(@RequestBody ForgetPasswordDTO forgetPasswordDTO);

    /**
     * 检查用户名是否重复
     * @param userExistsDTO
     * @return
     */
    @PostMapping("/user/checkUsername")
    Message<UserDTO> checkUsername(@RequestBody UserExistsDTO userExistsDTO);

    /**
     * 根据企业名称和角色查询用户
     * @param userDTO
     * @return
     */
    @PostMapping("/user/getUserByRoleSignAndOrgName")
    Message<User> getUserByRoleSignAndOrgName(@RequestBody UserDTO userDTO);

    /**
     * 根据id集合查询用户对象集合
     *
     * @author yuezheng
     * @param idList
     * @return List<User>
     * @date 2022/4/16 4:39 PM
     */
    @PostMapping("/user/getByUserIdList")
    Message<List<User>> getByUserIdList(@RequestBody List<Long> idList);


    /**
     * 根据企业id集合查询用户
     *
     * @author yuezheng
     * @param orgIdList
     * @return org.fzzn.core.model.msg.Message
     * @date 2022/4/23 10:12 AM
     */
    @PostMapping("/user/findUserByOrgList")
    Message<List<User>> findUserByOrgList(@RequestBody List<String> orgIdList);


    /**
     * 根据id查询投标人
     *
     * @param userList
     * @return org.fzzn.core.model.msg.Message
     * @author yuezheng
     * @date 2022/4/23 10:12 AM
     */
    @PostMapping("/user/finBidUserByUserList")
    Message<List<User>> finBidUserByUserList(@RequestBody List<User> userList);

    /**
     * 根据机构交易码和roleSign查找用户
     * @param zappUserDTO
     * @return
     */
    @PostMapping("/user/getUserByUnifiedTransactionCodeAndRoleSign")
    User getUserByUnifiedTransactionCodeAndRoleSign(@RequestBody ZappUserDTO zappUserDTO);

    @PostMapping("/user/getUserByOrgAndPhoneAndRoleSign")
    User getUserByOrgAndPhoneAndRoleSign(@RequestBody ForgetPasswordDTO forgetPasswordDTO);

    /**
     * 根据中招信息判断是否绑定了对应的账号
     * @param zappUserDTO
     * @return
     */
    @PostMapping("/user/existBindUser")
    Message<Boolean> existBindUser(@RequestBody ZappUserDTO zappUserDTO);

    /**
     * 获取公司下的企业管理员账号
     * @param userDTO
     * @return
     */
    @PostMapping("/user/findManagerByOrgId")
    Message<User> findManagerByOrgId(@RequestBody UserDTO userDTO);

}
